<?php
/*
*
* @author admin@teksonicmods.com
* @package acp_recruitment.php
* @version $Id: v1.3.1
* @copyright (c) Teksonic @ (www.teksonicmods.com)
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

/**
* @package acp
*/

class acp_recruitment
{
	var $u_action;
	var $new_config = array();

	function main($id, $mode)
	{
		global $db, $user, $template;
		global $config, $portal_config, $phpbb_root_path, $phpbb_admin_path, $phpEx;

		include($phpbb_root_path . 'portal/includes/functions.' . $phpEx);

		$portal_config = obtain_portal_config();

		$user->add_lang('mods/lang_recruitment_acp');

		$action = request_var('action', '');
		$submit = (isset($_POST['submit'])) ? true : false;
		
		$this->new_config = $portal_config;
		switch ($mode)
		{
			case 'main_options':
			$display_vars = array(
					'title'	=> 'RECRUIT',
					'$title_explain' => false,
					'vars'	=> array(
						'legend1'		=> 'OPTIONS',
						'recruit_block' => array('lang' => 'RECRUIT_BLOCK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
						'op1'			=> array('lang' => 'CLASSCOLOR','validate' => 'string',	'type' => 'radio:yes_no', 'explain' => true),
						'op2'			=> array('lang' => 'DEFAULT_LEVEL','validate' => 'string', 'type' => 'select', 'explain' => true, 'method' => 'opt2'),
						'op3'			=> array('lang' => 'R_LINK','validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'opt3'),
						'recruit_forum'	=> array('lang' => 'RECRUIT_FORUM', 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_r_forums'),
						'recruit_link'	=> array('lang' => 'RECRUIT_LINK', 'validate' => 'string', 'type' => 'text:30:100', 'explain' => true),
						
						'legend2'		=> 'DEATHKNIGHT',
						'dk1'			=> array('lang' => 'BLOOD', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'deathkknight1'),
						'dk2'			=> array('lang' => 'FROST', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'deathkknight2'),
						'dk3'			=> array('lang' => 'UNHOLY', 'validate' => 'string', 'type' => 'select', 'explain' => true, 'method' => 'deathkknight3'),
						
						'legend3'		=> 'DRUID',
						'druid1'		=> array('lang' => 'BALANCE', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'druid1'),
						'druid2'		=> array('lang' => 'FERAL', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'druid2'),
						'druid3'		=> array('lang' => 'RESTORATION', 'validate' => 'string', 'type' => 'select', 'explain' => true, 'method' => 'druid3'),
						
						'legend4'		=> 'HUNTER',
						'hunter1'		=> array('lang' => 'BEASTMASTERY', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'hunter1'),
						'hunter2'		=> array('lang' => 'MARKSMANSHIP', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'hunter2'),
						'hunter3'		=> array('lang' => 'SURVIVAL', 'validate' => 'string', 'type' => 'select', 'explain' => true, 'method' => 'hunter3'),
						
						'legend5'		=> 'MAGE',
						'mage1'			=> array('lang' => 'ARCANE', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'mage1'),
						'mage2'			=> array('lang' => 'FIRE', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'mage2'),
						'mage3'			=> array('lang' => 'FROST', 'validate' => 'string', 'type' => 'select', 'explain' => true, 'method' => 'mage3'),
						
						'legend6'		=> 'PALADIN',
						'paladin1'		=> array('lang' => 'HOLY', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'paladin1'),
						'paladin2'		=> array('lang' => 'PROTECTION', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'paladin2'),
						'paladin3'		=> array('lang' => 'RETRIBUTION', 'validate' => 'string', 'type' => 'select', 'explain' => true, 'method' => 'paladin3'),
						
						'legend7'		=> 'PRIEST',
						'priest1'		=> array('lang' => 'DISIPLINE', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'priest1'),
						'priest2'		=> array('lang' => 'HOLY', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'priest2'),
						'priest3'		=> array('lang' => 'SHADOW', 'validate' => 'string', 'type' => 'select', 'explain' => true, 'method' => 'priest3'),
						
						'legend8'		=> 'ROGUE',
						'rogue1'		=> array('lang' => 'ASSASSINATION', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'rogue1'),
						'rogue2'	=> array('lang' => 'COMBAT', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'rogue2'),
						'rogue3'			=> array('lang' => 'SUBTLETY', 'validate' => 'string', 'type' => 'select', 'explain' => true, 'method' => 'rogue3'),
						
						'legend9'		=> 'SHAMAN',
						'shaman1'		=> array('lang' => 'ELEMENTAL', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'shaman1'),
						'shaman2'		=> array('lang' => 'ENHANCEMENT', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'shaman2'),
						'shaman3'		=> array('lang' => 'RESTORATION', 'validate' => 'string', 'type' => 'select', 'explain' => true, 'method' => 'shaman3'),
						
						'legend10'		=> 'WARLOCK',
						'warlock1'		=> array('lang' => 'AFFLICTION', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'warlock1'),
						'warlock2'		=> array('lang' => 'DEMONOLOGY', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'warlock2'),
						'warlock3'		=> array('lang' => 'DESTRUCTION', 'validate' => 'string', 'type' => 'select', 'explain' => true, 'method' => 'warlock3'),
						
						'legend11'		=> 'WARRIOR',
						'warrior1'		=> array('lang' => 'ARMS', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'warrior1'),
						'warrior2'		=> array('lang' => 'FURY', 'validate' => 'string',	'type' => 'select', 'explain' => true, 'method' => 'warrior2'),
						'warrior3'		=> array('lang' => 'PROTECTION', 'validate' => 'string', 'type' => 'select', 'explain' => true, 'method' => 'warrior3'),
						
						'legend12'		=> 'SAVE',
						
		)
				);
			break;
			
		}

		if (isset($display_vars['lang']))
		{
			$user->add_lang($display_vars['lang']);
		}

		$cfg_array = (isset($_REQUEST['config'])) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config;
		$error = array();
		
		// We validate the complete config if whished
		validate_config_vars($display_vars['vars'], $cfg_array, $error);
		
		// Do not write values if there is an error
		if (sizeof($error))
		{
			$submit = false;
		}
		if ($submit)
		{
			switch( $mode )
			{
				case 'links':
					$links = array();

					for($i = 1; $i <= $this->link_num; ++$i)
					{
						$links[$i] = array(
							'url' => $cfg_array['portal_link_'.$i.'_url'],
							'text' => $cfg_array['portal_link_'.$i.'_text'],
						);
					}					
					$display_vars['vars']['portal_links_array'] = '';
					$cfg_array['portal_links_array'] = serialize($links);
				break;
			}
		}

		// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
		foreach ($display_vars['vars'] as $config_name => $null)
		{
			if (!isset($cfg_array[$config_name]))
			{
				continue;
			}

			$this->new_config[$config_name] = $config_value = $cfg_array[$config_name];

			if ($submit)
			{
					set_portal_config($config_name, $config_value);		
			}
		}

		if ($submit)
		{
			add_log('admin', 'LOG_PORTAL_CONFIG', $user->lang['ACP_PORTAL_' . strtoupper($mode) . '_INFO']);
			trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action));
		}

		$this->tpl_name = 'acp_board';
		$this->page_title = $display_vars['title'];

		$title_explain = $user->lang[$display_vars['title'] . '_EXPLAIN'];
		$template->assign_vars(array(
			'L_TITLE'			=> $user->lang[$display_vars['title']],
			'L_TITLE_EXPLAIN'	=> $title_explain,
			'S_ERROR'			=> (sizeof($error)) ? true : false,
			'ERROR_MSG'			=> implode('<br />', $error),
			
			'U_ACTION'			=> $this->u_action)
		);

		// Output relevant page
		foreach ($display_vars['vars'] as $config_key => $vars)
		{
			if (!is_array($vars) && strpos($config_key, 'legend') === false)
			{
				continue;
			}

			if (strpos($config_key, 'legend') !== false)
			{
				$template->assign_block_vars('options', array(
					'S_LEGEND'		=> true,
					'LEGEND'		=> (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars)
				);

				continue;
			}

			$type = explode(':', $vars['type']);

			$l_explain = '';
			if ($vars['explain'] && isset($vars['lang_explain']))
			{
				$l_explain = (isset($user->lang[$vars['lang_explain']])) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain'];
			}
			else if ($vars['explain'])
			{
				$l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : '';
			}

			$template->assign_block_vars('options', array(
				'KEY'			=> $config_key,
				'TITLE'			=> (isset($user->lang[$vars['lang']])) ? $user->lang[$vars['lang']] : $vars['lang'],
				'S_EXPLAIN'		=> $vars['explain'],
				'TITLE_EXPLAIN'	=> $l_explain,
				'CONTENT'		=> build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars),
				)
			);
			unset($display_vars['vars'][$config_key]);
		}
	}
function opt2($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function opt3($value, $key = '')
	{
		global $user;
		return '<option value="f_link"' . (($value == 'f_link') ? ' selected="selected"' : '') . '>' . $user->lang['RECRUIT_FORUM'] . '</option>
				<option value="c_link"' . (($value == 'c_link') ? ' selected="selected"' : '') . '>' . $user->lang['RECRUIT_LINK'] . '</option>';
	}
function deathkknight1($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function deathkknight2($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function deathkknight3($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function druid1($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function druid2($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function druid3($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function hunter1($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function hunter2($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function hunter3($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function mage1($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function mage2($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function mage3($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function paladin1($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function paladin2($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function paladin3($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function priest1($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function priest2($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function priest3($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function rogue1($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function rogue2($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function rogue3($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function shaman1($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function shaman2($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function shaman3($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function warlock1($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function warlock2($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function warlock3($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function warrior1($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function warrior2($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
function warrior3($value, $key = '')
	{
		global $user;
		return '<option value="none"' . (($value == 'none') ? ' selected="selected"' : '') . '>' . $user->lang['NONE'] . '</option>
				<option value="low"' . (($value == 'low') ? ' selected="selected"' : '') . '>' . $user->lang['LOW'] . '</option>
				<option value="med"' . (($value == 'med') ? ' selected="selected"' : '') . '>' . $user->lang['MED'] . '</option>
				<option value="high"' . (($value == 'high') ? ' selected="selected"' : '') . '>' . $user->lang['HIGH'] . '</option>';
	}
	// Create forum select box
	function select_r_forums($value, $key)
	{
		global $user, $config, $portal_config;

		$forum_list = make_forum_select(false, false, true, true, true, false, true);
		
		$selected = array();
		if(isset($portal_config[$key]) && strlen($portal_config[$key]) > 0)
		{
			$selected = explode(',', $portal_config[$key]);
		}
		// Build forum options
		$s_fopt = '<select id="' . $key . '" name="config[' . $key . ']">';
		foreach ($forum_list as $f_id => $f_row)
		{
			$s_fopt .= '<option value="' . $f_id . '"' . ((in_array($f_id, $selected)) ? ' selected="selected"' : '') . (($f_row['disabled']) ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>';
		}
		$s_fopt .= '</select>';

		return $s_fopt;
	}
	
	// Store selected forums
	function store_r_forums($key)
	{
		global $db, $cache;
		
		// Get selected extensions
		$values = request_var($key, array(0 => ''));
		
		$recruit = implode(',', $values);
		
		set_portal_config($key, $recruit);
	
	}
}

function utf_unserialize($serial_str) {
    $out = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$2').':\"$2\";'", $serial_str );
    return unserialize($out);   
}

?>